package safeCommitter.core.template;

import org.eclipse.jdt.internal.core.JavaProject;
import org.eclipse.jface.viewers.ISelection;

import safeCommitter.core.diffrunbridge.ExecutorBridge;
import safeCommitter.core.diffrunbridge.IExecutorBridge;
import safeCommitter.core.diffrunbridge.SearchExecutorBridge;
import safeCommitter.core.preferences.SCPreferenceConstants;

public abstract class ASCTemplate implements ISCTemplate {

	private ISelection selection;
	protected JavaProject javaProject;

	protected ISelection getSelection() {
		return selection;
	}

	protected void setSelection(final ISelection selection) {
		this.selection = selection;
	}

	public void executeTests(final JavaProject javaProject) {
		this.javaProject = javaProject;

	}

	protected IExecutorBridge getTemplate() {
		boolean performSearch = Activator.getDefault().getPreferenceStore()
				.getBoolean(SCPreferenceConstants.P_PERFORM_SEARCH);
		return performSearch ? new SearchExecutorBridge()
				: new ExecutorBridge();
	}

}
